#ifndef ABSTRACTBOARD_H
#define ABSTRACTBOARD_H

#include "Point.h"
#include "MoveTree.h"
#include <vector>

class AbstractBoard
{
    private:
        int w, h;
        int board[19][19];
        int groups[19][19];
        int group_id;
        MoveTree *move_tree;

        void makeBlackPlay(int x, int y);
        void makeWhitePlay(int x, int y);
        void printBoard();

        void addToGroups(int x, int y, int color);
        std::vector<Point *> getSameColorNeighbors(int x, int y, int color);
        void unite(int x, int y, std::vector<Point *> neighbors);
        std::vector<Point *> getGroup(int gid);
        std::vector<Point *> getGroup(int x, int y);
        void printPointList(std::vector<Point *> list);
        void printIntList(std::vector<int> list);
        void processEnemyCapture(int x, int y);
        std::vector<int> getNeighborGroups(int x, int y);
        bool pointInList(Point *p, std::vector<Point *> list);
        bool intInList(int i, std::vector<int> list);
        int flipColor(int color);
        int groupLiberties(int group);
        int getStoneLiberties(int x, int y);
        void deleteGroup(int gid);
        bool suicide(int x, int y);

    public:
        AbstractBoard();
        bool isEmptySpot(int x, int y);
        int getPlay(int x, int y);
        bool makePlay(int x, int y, int color);
        int undo();
        void clear();
};

#endif
